﻿#region File and License Information
/*
<File>
	<License>
		Copyright © 2009 - 2017, Daniel Vaughan. All rights reserved.
		This file is part of Calcium (http://calciumsdk.net), 
		which is released under the MIT License.
		See file /Documentation/License.txt for details.
	</License>
	<CreationDate>2010-12-10 13:05:43Z</CreationDate>
</File>
*/
#endregion

using System;
using System.Runtime.Serialization;

#if NETFX_CORE
using Windows.UI.Xaml.Input;
#else
using System.Windows.Input;
#endif

namespace Outcoder.Services.DialogService
{
	/* TODO: [DV] Comment. */
	[DataContract(Namespace = OrganizationalConstants.DataContractNamespace), Serializable]
	public class TextResponseQuestion : IQuestion<TextResponse>
	{
		[DataMember]
		public string Question { get; set; }

		[DataMember]
		public InputScopeNameValue InputScope { get; set; }

		[DataMember]
		public string Caption { get; set; }

		[DataMember]
		public string ValidationExpression { get; set; }

		[DataMember]
		public string ValidationFailedMessage { get; set; }

		[DataMember]
		public string Details { get; set; }

		[DataMember]
		public string DefaultResponse { get; set; }

		public TextResponseQuestion(
			string question,
			InputScopeNameValue inputScope = InputScopeNameValue.Default)
		{
			Question = question;
			InputScope = inputScope;
		}

		internal TextResponseQuestion()
		{
			/* Intentionally left blank. */
		}
	}

//	/* TODO: [DV] Comment. */
//	public enum TextResponseQuestionType
//	{
//		Default,
//		Url,
//		PhoneNumber,
//		EmailAddress,
//		Digits,
//		Chat,
//		Text
//	}

	/* TODO: [DV] Comment. */
	[DataContract(Namespace = OrganizationalConstants.DataContractNamespace), Serializable]
	public class TextResponse //: IQuestionResponse
	{
		[DataMember]
		public string Text { get; set; }

		[DataMember]
		public OkCancelQuestionResult OkCancelQuestionResult { get; set; }

		public TextResponse(OkCancelQuestionResult result, string answer)
		{
			OkCancelQuestionResult = result;
			Text = answer;
		}

		internal TextResponse()
		{
			/* Intentionally left blank. */
		}

		public bool HasValidAnswer
		{
			get
			{
				return OkCancelQuestionResult == OkCancelQuestionResult.Ok 
					&& Text != null;
			}
		}
	}
}